<notdefined name="W_UPLOADIFY">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/Uploadify/uploadify.css" />
<script type="text/javascript" src="__PUBLIC__/Js/Uploadify/jquery.uploadify.js"></script>
<define name="W_UPLOADIFY" value="1" />
</notdefined>

<div class="IfyImagesBox">
    <div class="ImageList">
        <notempty name="value">
        <foreach name="value" item="img">
            <div class="ImageListImg"><img src="__ROOT__{$img}" width="128" height="108" /><input type="hidden" name="{$name}[]" value="{$img}" /><img class="IfyImageCancel" src="__ROOT__/Public/Js/Uploadify/cancel.png"></div>
        </foreach>
        </notempty>
    </div><br/>
    <input class="IfyImage" id="{$name}" type="file" />
</div>

<script type="text/javascript">
$(function(){
    $("#{$name}").uploadify({
        'swf'      : "__PUBLIC__/Js/Uploadify/uploadify.swf",//定义uploadify.swf的路径
        'uploader' : "{:U('Admin/Index/widget/name/uploadify')}",//后端处理路径
        'button_image_url':'__PUBLIC__/Js/Uploadify/clarity.png',

        'auto':true,//自动上传
        'multi': true,//允许多选

        'fileObjName':'IfyData',//POST名称
        'formData' : {
            'session_id' : "{:session_id()}",
            //动态配置参数
            <foreach name="config" item="v" key="k">
            "{$k}":"{$v}",
            </foreach>

        },
        
        'fileTypeExts' : "*.gif,*.jpg,*.jpeg,*.bmp,*.png;",

        'buttonClass':'btn',
        'buttonText':'文件上传',

        'height' : 25,
        'width'  : 70,

        'debug':false,//开启调试
        'queueID':true,//禁用queue
        'preventCaching':true,
        'overrideEvents' : ['onSelect','onUploadProgress'],//禁用div.uploadify-queue,禁用progress样式
        'onUploadSuccess' : function(file, data, response) {
            var obj = $.parseJSON(data);
            var name = $('#'+this.movieName+'').parent('div').attr('id');
            var str='<div class="ImageListImg"><img src="__ROOT__'+obj.path+'" width="128" height="108" /><input type="hidden" name="{$name}[]" value="'+obj.path+'" /><img class="IfyImageCancel" src="__ROOT__/Public/Js/Uploadify/cancel.png"></div>';
            $('div#'+name).siblings('div.ImageList').append(str);
        }

    });
    $('.ImageList').delegate('.IfyImageCancel','click',function(){
        $(this).parent('div.ImageListImg').fadeOut('slow',function(){$(this).remove();});
    });
});
</script>